#include <iostream>
#include <stdlib.h>

using namespace std;

int __max(int a, int b)
{
	if(a > b) return a;
	return b;
}

int main()
{
	int a0, a1, a2, a3; // a* - used to store the series
	int risha0, risha1, risha2, risha3; // risha* - used to store the risha series
	int sum; // sum - used to store the sum of the risha series
	double exact_avg; // exact_avg - used to store the exact average
	int round_avg; // round_avg - used to store the rounded average

	cout << "Please enter a series of four numbers:" << endl;
	cin >> a0 >> a1 >> a2 >> a3;

	risha0 = a0;
	risha1 = __max(a0, a1);
	risha2 = __max(risha1, a2);
	risha3 = __max(risha2, a3);

	sum = risha0 + risha1 + risha2 + risha3;
	exact_avg = ((double)sum) / 4;
	round_avg = (int)(exact_avg + 0.5);

	cout << "The risha series members are:" << endl \
		<< risha0 << " ," << risha1 << " ," << risha2 << " ," << risha3 << endl;
	cout << "The exact average is: " << exact_avg << endl\
		<< "The rounded average is: " << round_avg << endl;

	return 0;
}
//output
//Please enter a series of four numbers: 1 5 5 12
//The risha series members are:
//1 ,5 ,5 ,12
//The exact average is: 5.75
//The rounded average is: 6
